-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exclude pgp signtures as attachments #5602
Conversation
rebase, resolve and merge |
3d4ea65
to
56c66be
Compare
Code moved from IMAPMessage to ImapMessageFetcher. |
56c66be
to
4ed234a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks scary but good
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
4ed234a
to
14bc67e
Compare
Thanks for the reminder 👍 Rebased the branch. It should be much easier to review now because #8597 was merged a while ago. I will take a look next week and mark it as ready if we still need it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works.
Christoph's advent of code is going strong 💪 🎄 🎁
/backport to stable3.5 |
Sadly this is the first PR I could really get merge 🫠 |
Story: I tried to forward an email with an OpenPGP signature.
This led to an internal server error:
Argument 2 passed to OCA\\Mail\\Model\\Message::addRawAttachment() must be of the type string, null given, called in mail/lib/Service/MailTransmission.php on line 412
1: Show the email body and attachments
2: Forward an email with openpgp attachment
loadMessageBodies
is using$structure->getParts()
to fetch the parts of a message.getRawAttachments
is using$structure->partIterator()
to fetch the parts of a message.When using partIterator the $parent property is set. getParts does not set the $parent property.
Horde_Mime_Part.isAttachment
is using the $parent property to detect if an pgp-signature is an attachment or not: https://github.com/horde/Mime/blob/7f6d0aaea1a1f194f46ac4a0428b539df11b46e1/lib/Horde/Mime/Part.php#L1464-L1482tl;dr When viewing the message we see an attachment but when forwarding the same message we don't find the attachment anymore because isAttachment return different result.
I suspect that changing
$structure->getParts()
to$structure->partIterator()
inloadMessageBodies
is the proper fix. Yet that seems like a bigger change.